<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/indexAndCinema.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/indexAndCinema2.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
</head>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<body>
<!--header start-->
<header>
    <iframe src="${pageContext.request.contextPath}/top.jsp" frameborder="0" scrolling="no" id="top"></iframe>
</header>
<!--header end-->
<div class="headerTOPH2"></div>
<%--最新上线或热播：--%>
<div class="callbacks_container">
    <ul class="rslides" id="slider">
        <li  class="img-slide img1"><img src="images/dy-banner2.jpg" alt=""></li>
        <li  class="img-slide img2"><img src="images/dy-banner1.jpg" alt=""></li>
        <li  class="img-slide img3"><img src="images/dy-banner3.jpg" alt=""></li>
        <li  class="img-slide img4"><img src="images/dy-banner4.jpg" alt=""></li>
    </ul>
</div>
<!--product start-->
<div class="index-title" style="margin-top:70px;"><em>正在热映</em><i>/</i><em>Progress broadcast</em></div>
<section class="index-product" id="temp0">
    <script>
        $(function() {
            getMovieMessage();
            getMovieMessage2();
            getMovieMessage3();
        });

        function getMovieMessage() {

            $("#temp0").empty();

            var data = {"movieTemp":0}//影片状态
            $.ajax({
                url:"${pageContext.request.contextPath}/ShowMovies",
                method:"POST",
                data:data,
                success:function (data) {//后台返回数据
                    console.log(data);
                    for (var i=0;i < 6;i++){
                        var $div = $('<div class="movie-card-wrap"></div>');
                        var $a = $('<a href="${pageContext.request.contextPath}/getMovieByMovieName?movieName='+data[i].movieName+'" class="movie-card"></a>');
                        var $buyA = $('<a class="movie-card-buy" href="getMovieByMovieName?movieName='+data[i].movieName+'">选座购票</a>')
                        var $imgDiv = $('<div class="movie-card-poster"></div>')
                        var $movieImg = $('<img src='+data[i].movieImg+'>');
                        var $movieNameDiv = $('<div class="movie-card-name"></div>');
                        var $movieNameSpan = $('<span class="bt-l"></span>');
                        var $movieScoreSpan = $('<span class="bt-r"></span>');
                        var $movieInfo = $('<div class="movie-card-info"></div>');
                        var $movieCard = $('<div class="movie-card-list"></div>');
                        var $movieDirector = $('<span>')
                        var $movieProtagonist = $('<span>');
                        var $tempName = $('<span>');
                        var $movieTime = $('<span>');
                        $movieNameSpan.html(data[i].movieName);
                        $movieScoreSpan.html(data[i].movieNum);
                        $movieDirector.html("导演："+data[i].movieDirector);
                        $movieProtagonist.html("主演："+data[i].movieProtagonist);
                        $tempName.html("类型："+data[i].tempName);
                        $movieTime.html("片长：："+data[i].movieTime+"分钟");

                        $("#temp0").append($div);
                        $div.append($a).append($buyA);
                        $imgDiv.append($movieImg);
                        $movieInfo.append($movieCard);
                        $movieCard.append($movieDirector).append($movieProtagonist).append($tempName).append($movieTime);

                        $movieNameDiv.append($movieNameSpan).append($movieScoreSpan);
                        $a.append($imgDiv).append($movieNameDiv).append($movieInfo);

                    }
                }
            });
        }
    </script>
</section>
<a href="${pageContext.request.contextPath}/ShowMovies2?movieTemp=0" class="commonMoreBut">查看更多</a>
<!--product end-->

<!--application-case start-->
<div class="index-title"><em>即将上映</em><i>/</i><em>Coming soon</em></div>
<section class="index-product" id="temp1">
    <script>
        function getMovieMessage2() {

            $("#temp1").empty();

            var data = {"movieTemp":1}//影片状态
            $.ajax({
                url:"${pageContext.request.contextPath}/ShowMovies",
                method:"POST",
                data:data,
                success:function (data) {//后台返回数据
                    for (var i=0;i < 6;i++){
                        var $div = $('<div class="movie-card-wrap"></div>');
                        var $a = $('<a href="${pageContext.request.contextPath}/getMovieByMovieName?movieName='+data[i].movieName+'" class="movie-card"></a>');
                        var $buyA = $('<a class="movie-card-soon" href="#">上映时间:'+data[i].movieRelease+'</a>')
                        var $imgDiv = $('<div class="movie-card-poster"></div>')
                        var $movieImg = $('<img src="'+data[i].movieImg+'">');
                        var $movieNameDiv = $('<div class="movie-card-name"></div>');
                        var $movieNameSpan = $('<span class="bt-l"></span>');
                        var $movieScoreSpan = $('<span class="bt-r"></span>');
                        var $movieInfo = $('<div class="movie-card-info"></div>');
                        var $movieCard = $('<div class="movie-card-list"></div>');
                        var $movieDirector = $('<span>')
                        var $movieProtagonist = $('<span>');
                        var $tempName = $('<span>');
                        var $movieTime = $('<span>');
                        $movieNameSpan.html(data[i].movieName);
                        $movieScoreSpan.html(data[i].movieNum);
                        $movieDirector.html("导演："+data[i].movieDirector);
                        $movieProtagonist.html("主演："+data[i].movieProtagonist);
                        $tempName.html("类型："+data[i].tempName);
                        $movieTime.html("片长：："+data[i].movieTime+"分钟");


                        $("#temp1").append($div);
                        $div.append($a).append($buyA);
                        $imgDiv.append($movieImg);
                        $movieInfo.append($movieCard);
                        $movieCard.append($movieDirector).append($movieProtagonist).append($tempName).append($movieTime);

                        $movieNameDiv.append($movieNameSpan).append($movieScoreSpan);
                        $a.append($imgDiv).append($movieNameDiv).append($movieInfo);

                    }
                }
            });
        }
    </script>

</section>
<a href="${pageContext.request.contextPath}/ShowMovies2?movieTemp=1" class="commonMoreBut">查看更多</a>
<!--application-case end-->

<!--news start-->
<div class="index-title"><em>最近上市</em><i>/</i><em>Recently listed</em></div>
<section class="index-news">
    <script>
        function getMovieMessage3() {

            $(".index-news").empty();

            var data = {"movieTemp":null}//影片状态
            $.ajax({
                url:"${pageContext.request.contextPath}/ShowMovies",
                method:"POST",
                data:data,
                success:function (data) {//后台返回数据
                    console.log(data);
                    for (var i=0;i < 4;i++){
                        var $div = $('<div class="news-item"></div>');
                        var $div2 = $('<div class="time"><span><em>6</em><dl>日</dl></span><h2>2021年6月</h2></div>');
                        var $a = $('<a href="${pageContext.request.contextPath}/getMovieByMovieName?movieName='+data[i].movieName+'" class="info"></a>');
                        var $h2 = $('<h2>'+data[i].movieName+'</h2>');
                        var $p = $('<p><span>导演：'+data[i].movieDirector+' 主演：'+data[i].movieProtagonist+'</span><br>'+data[i].movieDescribe+'</p>');

                        $(".index-news").append($div);
                        $a.append($h2).append($p);
                        $div.append($div2).append($a);
                    }
                }
            });
        }
    </script>
</section>
<!--news end-->
<iframe src="${pageContext.request.contextPath}/foot.jsp" frameborder="0" scrolling="no" id="foot"></iframe>
</body>
</html>